﻿using System;

namespace Ganss.Excel.Tests.Data
{
    class NestedProduct
    {
        public string Name { get; set; }
        public int Number { get; set; }
        public decimal Price { get; set; }
        public OfferDetails Offer { get; set; } = new();

        public override bool Equals(object obj)
        {
            if (obj is not NestedProduct o) return false;
            return o.Name == Name && o.Number == Number && o.Price == Price && o.Offer.Equals(Offer);
        }

        public override int GetHashCode()
        {
            return HashCode.Combine(Name, Number, Price, Offer);
        }

        public NestedProduct(string name, int number, decimal price, OfferDetails offer)
        {
            Name = name;
            Number = number;
            Price = price;
            Offer = offer;
        }

        public NestedProduct() { }
    }
}